home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / language2.rng < prev    next >
Extensible Markup Language  |  2008-09-09  |  13KB  |  462 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
  5.  Copyright (C) 2005-2007 Emanuele Aina
  6.  
  7.  This library is free software; you can redistribute it and/or
  8.  modify it under the terms of the GNU Library General Public
  9.  License as published by the Free Software Foundation; either
  10.  version 2 of the License, or (at your option) any later version.
  11.  
  12.  This library is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  Library General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU Library General Public
  18.  License along with this library; if not, write to the
  19.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  Boston, MA 02111-1307, USA.
  21.  
  22. -->
  23. <grammar xmlns="http://relaxng.org/ns/structure/1.0"
  24.          datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  25. <start>
  26.     <element name="language">
  27.         <choice>
  28.             <attribute name="name"/>
  29.             <attribute name="_name"/>
  30.         </choice>
  31.  
  32.         <attribute name="id">
  33.             <data type="string">
  34.                 <param name="pattern">([a-zA-Z0-9_]|-)+</param>
  35.             </data>
  36.         </attribute>
  37.  
  38.         <attribute name="version"/>
  39.  
  40.         <optional>
  41.             <choice>
  42.                 <attribute name="section"/>
  43.                 <attribute name="_section"/>
  44.             </choice>
  45.         </optional>
  46.  
  47.         <optional>
  48.             <attribute name="hidden">
  49.                 <ref name="boolean-value"/>
  50.             </attribute>
  51.         </optional>
  52.  
  53.         <optional>
  54.             <attribute name="translation-domain"/>
  55.         </optional>
  56.  
  57.         <optional>
  58.             <oneOrMore>
  59.                 <element name="author">
  60.                     <text/>
  61.                 </element>
  62.             </oneOrMore>        
  63.         </optional>
  64.     
  65.         <optional>
  66.             <ref name="metadata"/>
  67.         </optional>
  68.  
  69.         <optional>
  70.             <ref name="styles" />
  71.         </optional>
  72.  
  73.         <optional>
  74.             <element name="default-regex-options">
  75.                 <ref name="regex-options"/>
  76.             </element>
  77.         </optional>
  78.  
  79.         <optional>
  80.             <element name="keyword-char-class">
  81.                 <text/>
  82.             </element>
  83.         </optional>
  84.  
  85.         <ref name="definitions" />
  86.     </element>
  87. </start>
  88.  
  89.  
  90.  
  91. <define name="id-type">
  92.     <data type="string">
  93.         <!-- FIXME: Why it doesn't work?
  94.              It seems that [a-z-] is unsupported -->
  95.         <!--
  96.         <param name="pattern">([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]+</param>
  97.         -->
  98.         <param name="pattern">(([a-zA-Z0-9_]|-)+:)?([a-zA-Z0-9_]|-)+</param>
  99.     </data>
  100. </define>
  101.  
  102. <define name="ref-type">
  103.     <data type="string">
  104.         <!-- FIXME: Why it doesn't work?
  105.              It seems that [a-z-] is unsupported -->
  106.         <!--
  107.         <param name="pattern">([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]+(:\*)?</param>
  108.         -->
  109.         <param name="pattern">(([a-zA-Z0-9_]|-)+:)?([a-zA-Z0-9_]|-)+(:\*)?</param>
  110.     </data>
  111. </define>
  112.  
  113. <define name="boolean-value">
  114.     <choice>
  115.         <value>true</value>
  116.         <value>false</value>
  117.     </choice>
  118. </define>
  119.  
  120. <define name="regex-options">
  121.     <optional>
  122.         <attribute name="extended">
  123.             <ref name="boolean-value"/>
  124.         </attribute>
  125.     </optional>
  126.     <optional>
  127.         <attribute name="case-sensitive">
  128.             <ref name="boolean-value"/>
  129.         </attribute>
  130.     </optional>
  131.     <optional>
  132.         <attribute name="dupnames">
  133.             <ref name="boolean-value"/>
  134.         </attribute>
  135.     </optional>
  136. </define>
  137.  
  138.  
  139. <define name="property">
  140.     <element name="property">
  141.         <attribute name="name">
  142. <!--          <data type="string">-->
  143. <!--              <param name="pattern">([a-zA-Z0-9_]|-)+</param>-->
  144. <!--          </data>-->
  145.         </attribute>
  146.         <text/>
  147. <!--        <optional>
  148.             <attribute name="mimetypes"/>
  149.         </optional>-->
  150.     </element>
  151. </define>
  152.  
  153. <define name="metadata">
  154.     <element name="metadata">
  155.         <zeroOrMore>
  156.             <ref name="property"/>
  157.         </zeroOrMore>
  158.     </element>
  159. </define>
  160.  
  161. <define name="styles">
  162.     <element name="styles">
  163.         <oneOrMore>
  164.             <element name="style">
  165.                 <attribute name="id">
  166.                     <data type="string">
  167.                         <param name="pattern">([a-zA-Z0-9_]|-)+</param>
  168.                     </data>
  169.                 </attribute>
  170.                 <choice>
  171.                     <attribute name="name"/>
  172.                     <attribute name="_name"/>
  173.                 </choice>
  174.                 <optional>
  175.                     <attribute name="map-to">
  176.                         <ref name="id-type"/>
  177.                     </attribute>
  178.                 </optional>
  179.             </element>
  180.         </oneOrMore>
  181.     </element>
  182. </define>
  183.  
  184. <define name="definitions">
  185.     <element name="definitions">
  186.         <interleave>
  187.             <oneOrMore>
  188.                 <choice>
  189.                     <ref name="context-to-be-included"/>
  190.                     <ref name="context-container"/>
  191.                     <ref name="context-simple"/>
  192.                     <ref name="context-reference"/>
  193.                     <ref name="context-placeholder"/>
  194.                 </choice>
  195.             </oneOrMore>
  196.             <zeroOrMore>
  197.                 <ref name="define-regex"/>
  198.             </zeroOrMore>
  199.             <zeroOrMore>
  200.                 <ref name="replace-context"/>
  201.             </zeroOrMore>
  202.         </interleave>
  203.     </element>
  204. </define>
  205.  
  206.  
  207. <define name="context-simple">
  208.     <element name="context">
  209.         <optional>
  210.             <attribute name="id">
  211.                 <ref name="id-type"/>
  212.             </attribute>
  213.         </optional>
  214.         <optional>
  215.             <attribute name="style-ref">
  216.                 <ref name="id-type"/>
  217.             </attribute>
  218.         </optional>
  219.         <optional>
  220.             <attribute name="extend-parent">
  221.                 <ref name="boolean-value"/>
  222.             </attribute>
  223.         </optional>
  224.         <optional>
  225.             <attribute name="end-parent">
  226.                 <ref name="boolean-value"/>
  227.             </attribute>
  228.         </optional>
  229.         <optional>
  230.             <attribute name="first-line-only">
  231.                 <ref name="boolean-value"/>
  232.             </attribute>
  233.         </optional>
  234.         <optional>
  235.             <attribute name="once-only">
  236.                 <ref name="boolean-value"/>
  237.             </attribute>
  238.         </optional>
  239.  
  240.         <choice>
  241.             <element name="match">
  242.                 <ref name="regex-options"/>
  243.                 <text/>
  244.             </element>
  245.  
  246.             <group>
  247.                 <optional>
  248.                     <element name="prefix"><text/></element>
  249.                 </optional>
  250.                 <optional>
  251.                     <element name="suffix"><text/></element>
  252.                 </optional>
  253.                 <oneOrMore>
  254.                     <element name="keyword"><text/></element>
  255.                 </oneOrMore>
  256.             </group>
  257.         </choice>
  258.  
  259.         <optional>
  260.             <element name="include">
  261.                 <oneOrMore>
  262.                     <ref name="context-subpattern-simple"/>
  263.                 </oneOrMore>
  264.             </element>
  265.         </optional>
  266.     </element>
  267. </define>
  268.  
  269. <define name="context-container">
  270.     <element name="context">
  271.         <optional>
  272.             <attribute name="id">
  273.                 <ref name="id-type"/>
  274.             </attribute>
  275.         </optional>
  276.         <optional>
  277.             <attribute name="style-ref">
  278.                 <ref name="id-type"/>
  279.             </attribute>
  280.         </optional>
  281.         <optional>
  282.             <attribute name="style-inside">
  283.                 <ref name="boolean-value"/>
  284.             </attribute>
  285.         </optional>
  286.         <optional>
  287.             <attribute name="extend-parent">
  288.                 <ref name="boolean-value"/>
  289.             </attribute>
  290.         </optional>
  291.         <optional>
  292.             <attribute name="end-parent">
  293.                 <ref name="boolean-value"/>
  294.             </attribute>
  295.         </optional>
  296.         <optional>
  297.             <attribute name="end-at-line-end">
  298.                 <ref name="boolean-value"/>
  299.             </attribute>
  300.         </optional>
  301.         <optional>
  302.             <attribute name="first-line-only">
  303.                 <ref name="boolean-value"/>
  304.             </attribute>
  305.         </optional>
  306.         <optional>
  307.             <attribute name="once-only">
  308.                 <ref name="boolean-value"/>
  309.             </attribute>
  310.         </optional>
  311.  
  312.         <element name="start">
  313.             <ref name="regex-options"/>
  314.             <text/>
  315.         </element>
  316.         <optional>
  317.             <element name="end">
  318.                 <ref name="regex-options"/>
  319.                 <text/>
  320.             </element>
  321.         </optional>
  322.  
  323.         <optional>
  324.             <element name="include">
  325.                 <interleave>
  326.                     <oneOrMore>
  327.                         <choice>
  328.                             <ref name="context-container"/>
  329.                             <ref name="context-simple"/>
  330.                             <ref name="context-to-be-included"/>
  331.                             <ref name="context-subpattern-container"/>
  332.                             <ref name="context-reference"/>
  333.                             <ref name="context-placeholder"/>
  334.                         </choice>
  335.                     </oneOrMore>
  336.                     <zeroOrMore>
  337.                         <ref name="define-regex"/>
  338.                     </zeroOrMore>
  339.                 </interleave>
  340.             </element>
  341.         </optional>
  342.     </element>
  343. </define>
  344.  
  345. <define name="context-to-be-included">
  346.     <element name="context">
  347.         <attribute name="id">
  348.             <ref name="id-type"/>
  349.         </attribute>
  350.  
  351.         <element name="include">
  352.             <interleave>
  353.                 <oneOrMore>
  354.                     <choice>
  355.                         <ref name="context-container"/>
  356.                         <ref name="context-simple"/>
  357.                         <ref name="context-to-be-included"/>
  358.                         <ref name="context-reference"/>
  359.                         <ref name="context-placeholder"/>
  360.                     </choice>
  361.                 </oneOrMore>
  362.                 <zeroOrMore>
  363.                     <ref name="define-regex"/>
  364.                 </zeroOrMore>
  365.             </interleave>
  366.         </element>
  367.     </element>
  368. </define>
  369.  
  370. <define name="context-subpattern-simple">
  371.     <element name="context">
  372.         <optional>
  373.             <attribute name="id">
  374.                 <ref name="id-type"/>
  375.             </attribute>
  376.         </optional>
  377.         <optional>
  378.             <attribute name="style-ref">
  379.                 <ref name="id-type"/>
  380.             </attribute>
  381.         </optional>
  382.  
  383.         <attribute name="sub-pattern"/>
  384.     </element>
  385. </define>
  386.  
  387. <define name="context-subpattern-container">
  388.     <element name="context">
  389.         <optional>
  390.             <attribute name="id">
  391.                 <ref name="id-type"/>
  392.             </attribute>
  393.         </optional>
  394.         <optional>
  395.             <attribute name="style-ref">
  396.                 <ref name="id-type"/>
  397.             </attribute>
  398.         </optional>
  399.  
  400.         <attribute name="sub-pattern"/>
  401.  
  402.         <attribute name="where">
  403.             <choice>
  404.                 <value>start</value>
  405.                 <value>end</value>
  406.             </choice>
  407.         </attribute>
  408.     </element>
  409. </define>
  410.  
  411. <define name="context-reference">
  412.     <element name="context">
  413.         <attribute name="ref">
  414.             <ref name="ref-type"/>
  415.         </attribute>
  416.         <optional>
  417.             <choice>
  418.                 <attribute name="style-ref">
  419.                     <ref name="id-type"/>
  420.                 </attribute>
  421.                 <attribute name="ignore-style">
  422.                     <ref name="boolean-value"/>
  423.                 </attribute>
  424.                 <attribute name="original">
  425.                     <ref name="boolean-value"/>
  426.                 </attribute>
  427.             </choice>
  428.         </optional>
  429.     </element>
  430. </define>
  431.  
  432. <define name="context-placeholder">
  433.     <element name="context">
  434.         <attribute name="id">
  435.             <ref name="id-type"/>
  436.         </attribute>
  437.     </element>
  438. </define>
  439.  
  440. <define name="define-regex">
  441.     <element name="define-regex">
  442.         <attribute name="id">
  443.             <ref name="id-type"/>
  444.         </attribute>
  445.         <ref name="regex-options"/>
  446.         <text/>
  447.     </element>
  448. </define>
  449.  
  450. <define name="replace-context">
  451.     <element name="replace">
  452.         <attribute name="id">
  453.             <ref name="ref-type"/>
  454.         </attribute>
  455.         <attribute name="ref">
  456.             <ref name="ref-type"/>
  457.         </attribute>
  458.     </element>
  459. </define>
  460.  
  461. </grammar>
  462.